<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no"/>
    <title>积分转出</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../css/common.css"/>
    <style>
        body {
            background: #f3f3f3;
            font-size: 14px;
        }

        footer.aui-nav {
            z-index: 99999;
        }

        header.aui-bar {
            background: #fff;
        }

        .aui-title {
            color: #000;
        }

        .contain {
            position: relative;
            margin-bottom: 70px;
        }

        .aui-list-view {
            overflow: hidden;
        }

        .aui-list-view:after {
            border: none;
        }

        textarea {
            padding: 2px 8px;
            border: none;
            height: 80px;
            overflow-y: auto;
            margin-top: 5px;
        }

        .aui-list-view i.aui-iconfont {
            color: #000;
        }

        input[type="text"], input[type="number"], input[type="tel"] {
            line-height: 25px;
            margin: 0;
            width: inherit;
            padding: 0;
            border: 0;
        }
    </style>
</head>
<body>
<div class="contain">
    <!--<ul class="aui-list-view">-->
    <!--<li class="aui-list-view-cell" data-type="proType" tapmode onclick="showPicker(this)">-->
    <!--<a class="aui-arrow-right">-->
    <!--提现方式-->
    <!--<span class="menuRgiht tixianType">支付宝</span>-->
    <!--</a>-->
    <!--</li>-->
    <!--</ul>-->
    <ul class="aui-list-view">
        <li class="aui-list-view-cell ">
            <span id="sendVerify" class=" aui-margin-r-10 aui-btn-default  radius-6 aui-pull-left font-size-12"
                  onclick="getVerify()" style="padding:3px !important;">获取验证码</span>
            <input type="tel" class="verify" id="mobile" placeholder="请输入您手机的验证码" value="">
        </li>
        <li class="aui-list-view-cell">
            <span class="aui-margin-r-10">转 出 数 量</span>
            <input type="number" class="money" placeholder="可以提现的最大数为" value="">
        </li>
        <li class="aui-list-view-cell">
            <span class="aui-margin-r-10">对 方 手 机</span>
            <input type="number" class="phone" placeholder="输入对方号码" value="">
        </li>
        <!--<li class="aui-list-view-cell">-->
            <!--<span class="aui-margin-r-10">对 方 手 机</span>-->
            <!--<input type="text" class="carName" style="width:100px !important;" placeholder="输入对方号码" value="">-->
            <!--<span class="aui-margin-r-10 aui-btn aui-bg-danger colorWhite aui-pull-right" tapmode-->
                  <!--onclick="chooseCarType(this)"-->
                  <!--style="padding:2px 5px !important;">选择银行卡</span>-->
        <!--</li>-->

        <!--<li class="aui-list-view-cell">-->
            <!--<span class="aui-margin-r-10">银 行 账 号</span>-->
            <!--<input type="number" class="aui-col-xs-12 carNo"  placeholder="请输入您的银行账号" style="width: calc(100% - 110px)" value="">-->
        <!--</li>-->
        <!--<li class="aui-list-view-cell">-->
            <!--<span class="aui-margin-r-10">真 实 姓 名</span>-->
            <!--<input type="text" class="aui-col-xs-12 RealName"  placeholder="请输入您的开户真实姓名" style="width: calc(100% - 110px)" value="">-->
        <!--</li>-->
    </ul>
    <div class="aui-col-xs-12 aui-padded-10">
        <div class="myBtn radius-6" tapmode onclick="sendData()">提交</div>
    </div>
</div>
<!-- <footer class="aui-nav">
    <div class="myBtn">确认发布</div>
</footer> -->
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../script/doT.min.js"></script>
<script type="text/javascript" src="../script/jquery-1.11.3.js"></script>
<script type="text/javascript">
    apiready = function () {
        getStorageAll();
        api.parseTapmode();
        getUserInfo();
        setTimeout(function () {
            $(".money").attr("placeholder", "可以提现的最大数为" + jifen_returned);
        },2000)

    }
    // 设置体现方式
    function setType(obj) {
        $(".tixianType").text($(obj).text());
        hidePicker();
    }
    //获取验证码
    function getVerify() {
        getStorageAll();
        getUserInfo();
//        var mobile = $api.val($api.byId('mobile'));
        var mobile = user_name;
        //验证手机是否注册过
        var url = 'account/send_verifycode';
        var data = {};
        data['mobile'] = mobile;
        ajaxRequest(url, 'post', data, function (ret, err) {
            if (ret.success) {
                api.toast({
                    msg: "验证码已发送到手机尾号为：" + mobile.substr(mobile.length - 4, 4),
                    duration: 3000
                })
                var sendVerify = $api.byId('sendVerify');
                $api.removeAttr(sendVerify, 'onclick');
                //提交成功前不可更改，防止用发送后用其他号码注册 或者 在服务端验证
                var readonly_mobile = $api.byId('mobile');
//                $api.attr(readonly_mobile, 'readOnly', 'true');
                $api.html(sendVerify, '已发送(<span id="GetVerify">60</span>)');
                times = 60;
                isinerval = setInterval("CountDown()", 1000);

            }
        });
    }

    function CountDown() {
        if (times < 1) {
            //提交成功前不可更改，防止用户发送后用其他号码注册 或者 在服务端验证
            var readonly_mobile = $api.byId('mobile');
//            $api.removeAttr(readonly_mobile, 'readOnly');
            var sendVerify = $api.byId('sendVerify');
            $api.attr(sendVerify, 'onclick', 'getVerify()');
            $api.html(sendVerify, '重新获取');
            clearInterval(isinerval);
            return;
        }
        var getVerify = $api.byId('GetVerify');
        $api.html(getVerify, '' + times + '');
        times--;
    }
    function getCarNo(obj) {
        var carNo = $(obj).val();
        $(obj).val(changeNumFormat(carNo, 4))
    }
    function chooseCarType(obj) {
        api.actionSheet({
            title: "选择银行卡所属银行",
            cancelTitle: '取消',
//            destructiveTitle: '红色警告按钮',
            buttons: ['工商银行', '招商银行', '农业银行', '中国银行', '建设银行']
        }, function (ret, err) {
            var carHome = "";
            switch (ret.buttonIndex) {
                case 1:
                    carHome = "工商银行";
                    break;
                case 2:
                    carHome = "招商银行";
                    break;
                case 3:
                    carHome = "农业银行";
                    break;
                case 4:
                    carHome = "中国银行";
                    break;
                case 5:
                    carHome = "建设银行";
                    break;
                default :
                    return false;

            }
            $(obj).closest("li").find(".carName").val(carHome);
        })
    }
    function sendData() {
        var verifycode = $(".verify").val();
        var amount = $(".money").val();
        var bankname = $(".carName").val();
        var banknumber = $(".carNo").val();
        var RealName = $(".RealName").val();
        var url = 'account/withdraw_jifen';
        var data = {};
        data['verifycode'] = verifycode;
        data['amount'] = amount;
        data['bankname'] = bankname;
        data['banknumber'] = banknumber;
        data['realname'] = RealName;
//    alert(JSON.stringify(data))
        ajaxRequest(url, 'post', data, function (ret, err) {
            api.toast({
                msg: "提现申请成功"
            })
            setTimeout(function () {
                closeWin();
            }, 1500)
            api.sendEvent({
                name: "updateUserInfo",
                extra: {
                    value: true
                }
            })
        });
    }
</script>
</html>
